@using Microsoft.AspNetCore.Localization
@inject Microsoft.Extensions.Configuration.IConfiguration configuration
@inject Chino.IdentityServer.Services.Localization.IJsonLocalizationService JL
@inject CommonLocalizationService CL
@{
    ViewData["_dashboard"] = true;
    string pageName = (string)(ViewData["pageName"] ?? "unknow");

    bool IsPage(string name) => name == pageName;

    var currentCulture = Context.Features.Get<IRequestCultureFeature>()?.RequestCulture?.UICulture;
}


<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>@(ViewData["Title"] ?? "Chino") - @configuration["Chino:Dashboard:PageTitle"]</title>

    <link rel="stylesheet" href="~/css/chino-dashboard.css" />

    <environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-alpha3/dist/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="col-auto" asp-fallback-test-property="width"
              asp-fallback-test-value="auto"
              integrity="sha384-CuOF+2SnTUfTwSZjCXf01h7uYhfOBuxIhGKPbfEJ3+FqH/s6cIFN9bGr1HmAg4fQ"
              crossorigin="anonymous" />
    </environment>

</head>
<body>
    @*顶部导航栏*@
    <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
        <a href="/Dashboard" class="navbar-brand col-md-3 col-lg-2 me-0 px-3">@JL[(configuration["Chino:Dashboard:NavTitle"] ?? "Chino Dashboard"), currentCulture]</a>
        @*<a href="/Dashboard" class="navbar-brand col-md-3 col-lg-2 me-0 px-3">@(configuration["Chino:Dashboard:NavTitle"]??"Chino Dashboard")</a>*@

        @*在小屏上缩进用的按钮*@
        <button class="navbar-toggler position-absolute d-md-none collapsed"
                type="button"
                data-bs-toggle="collapse"
                data-bs-target="#sidebarMenu"
                data-toggle="collapse"
                data-target="#sidebarMenu"
                aria-controls="sidebarMenu"
                aria-expanded="false"
                aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

    </header>

    <div class="container-fluid">
        <div class="row">
            @*左侧导航栏*@
            <nav id="sidebarMenu" class="col-md-3 col-lg-3 col-xl-2 d-md-block bg-light sidebar collapse">
                <div class="position-sticky pt-3">
                    <ul class="nav flex-column">
                        @*总览*@
                        <li class=" nav-item">
                            <a class="nav-link @(IsPage("overview") ? "active" : string.Empty)" aria-current="page" asp-page="/Dashboard/Index">
                                <span class="oi oi-home"></span>
                                @CL["dashboard_nav_overview"]
                            </a>
                        </li>
                        @*用户（们）*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("users") ? "active" : string.Empty)" asp-page="/Dashboard/Users">
                                <span class="oi oi-people"></span>
                                @CL["dashboard_nav_users"]
                            </a>
                        </li>
                        @*角色*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("roles") ? "active" : string.Empty)" asp-page="/Dashboard/Roles">
                                <span class="oi oi-credit-card"></span>
                                @CL["dashboard_nav_roles"]
                            </a>
                        </li>
                        @*身份资源*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("identityResources") ? "active" : string.Empty)" asp-page="/Dashboard/IdentityResources">
                                <span class="oi oi-briefcase"></span>
                                @CL["dashboard_nav_identity_resources"]
                            </a>
                        </li>
                        @*Api资源*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("apiResources") ? "active" : string.Empty)" asp-page="/Dashboard/ApiResources">
                                <span class="oi oi-cloud"></span>
                                @CL["dashboard_nav_api_resources"]
                            </a>
                        </li>
                        @*Api作用域*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("apiScopes") ? "active" : string.Empty)" asp-page="/Dashboard/ApiScopes">
                                <span class="oi oi-bolt"></span>
                                @CL["dashboard_nav_api_scopes"]
                            </a>
                        </li>
                        @*客户端*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("clients") ? "active" : string.Empty)" asp-page="/Dashboard/Clients">
                                <span class="oi oi-monitor"></span>
                                @CL["dashboard_nav_clients"]
                            </a>
                        </li>
                        @*数据库*@
                        <li class="nav-item">
                            <a class="nav-link @(IsPage("database") ? "active" : string.Empty)" asp-page="/Dashboard/Database">
                                <span class="oi oi-spreadsheet"></span>
                                @CL["dashboard_nav_database"]
                            </a>
                        </li>

                    </ul>
                </div>
            </nav>

            @*正文部分*@
            <main class="col-md-9 ms-sm-auto col-lg-9 col-xl-10 px-md-4">
                @RenderBody()

                <partial name="DashboardFooter" />
            </main>


        </div>
    </div>

    @*<div>
            @RenderBody()
        </div>*@

    @*Footer*@
    @*<div class="row p-0 m-0">
        <div class="col-3 col-lg-3 col-xl-2">
            &ensp;
        </div>
        <div class="col-12 col-md-9 col-lg-9 col-xl-10 p-0 m-0">
            <partial name="Footer" />
        </div>
    </div>*@




    <environment include="Development">
        @*开发模式下的JS引用之类的*@
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
        <script src="~/lib/vue/vue.js"></script>
    </environment>
    <environment exclude="Development">
        @*发布模式下的js引用之类的*@
        <script src="~/lib/jquery/dist/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-alpha3/dist/js/bootstrap.bundle.min.js"
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
                asp-fallback-test="bootstrap"
                integrity="sha384-popRpmFF9JQgExhfw5tZT4I9/CI5e2QcuUZPOVXb1m7qUmeR2b50u+YFEYe1wgzy"
                crossorigin="anonymous"></script>

        <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"
                asp-fallback-src="~/lib/vue/vue.min.js"
                asp-fallback-test="Vue"
                crossorigin="anonymous"></script>
    </environment>

    <script src="~/js/chino-dashboard.js" asp-append-version="true"></script>

    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>
